import scrapy
from sat.items import SatItem
def authentication_failed(response):
    # TODO: Check the contents of the response and return True if it failed
    # or False if it succeeded.
    pass

class QuerySpider(scrapy.Spider):
	name='query'
	def start_requests(self):
		username=getattr(self,'username',None)
		password=getattr(self,'password',None)
		url='https://account.collegeboard.org/login/authenticateUser'
		formdata={'username':username,
		'password':password,
		'DURL':' https://nsat.collegeboard.org/satweb/login.jsp',
		'appid':'115',
		'idp':'ECL'}
		yield scrapy.FormRequest(url=url,formdata=formdata,callback=self.parse,dont_filter=True)
	def parse(self, response):
		item=SatItem()
		item['openid']=''
		item['testdate']=''
		item['subject']=''
		item['point']=''
		yield item
